package is.ru.tgra;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL11;

public class Light 
{
	//floats for each button press
	Point3D pos;
	
	
	Vector3D u;
	Vector3D v;
	Vector3D n;

	public Light(Point3D pEye, Point3D pCenter, Vector3D up)
	{
		pos = pEye;
		n = Vector3D.difference(pEye, pCenter);
		n.normalize();
		u = Vector3D.cross(up, n);
		u.normalize();
		v = Vector3D.cross(n, u);
	}
	
	public void setModelViewMatrix()
	{
		Vector3D minusPos = Vector3D.difference(new Point3D(0,0,0), pos);
	}
	
	public void slide(float delU, float delV, float delN)
	{
		pos.add(Vector3D.sum(Vector3D.mult(delU, u), Vector3D.sum(Vector3D.mult(delV, v), Vector3D.mult(delN, n))));
	}
	
	public void yaw(float angle)
	{
		float c = (float) Math.cos(angle*Math.PI/180.0f);
		float s = (float) Math.sin(angle*Math.PI/180.0f);
		Vector3D t = u;
		u = Vector3D.sum(Vector3D.mult(c, t), Vector3D.mult(s, n));
		n = Vector3D.sum(Vector3D.mult(-s, t), Vector3D.mult(c, n));
	}
	
	
}
